package com.mmche.web.dao;

import java.util.List;

import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Order;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;

import com.mmche.base.dao.BrandDao;
import com.mmche.base.dao.impl.BrandDaoImpl;
import com.mmche.base.pojo.Brand;

@Repository("webBrandDao")
public class WebBrandDao extends BrandDaoImpl implements BrandDao{

	@Override
	public List<Brand> getValidBrands() {
		Query query = new Query(Criteria.where("valid").is(true));
		query.addCriteria(Criteria.where("hidden").ne(true));
		query.sort().on("firstLetter", Order.ASCENDING).on("disp_seq", Order.ASCENDING).on("_id", Order.ASCENDING);
		return this.getMongoTemplate().find(query, Brand.class);
	}
}
